From bbbc6cd446495ea3995209e9b4d6b8919e854865 Mon Sep 17 00:00:00 2001 From: Frederik Wagner Date: Tue, 16 Sep 2014 09:07:33 +0200 Subject: [PATCH] (MODULES-1330) Change order of revokation --- lib/puppet/provider/mysql_grant/mysql.rb | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/puppet/provider/mysql_grant/mysql.rb b/lib/puppet/provider/mysql_grant/mysql.rb index 3fe691d..141645a 100644 --- a/lib/puppet/provider/mysql_grant/mysql.rb +++ b/lib/puppet/provider/mysql_grant/mysql.rb @@ -89,13 +89,15 @@ Puppet::Type.type(:mysql_grant).provide(:mysql, :parent => Puppet::Provider::Mys user_string = self.class.cmd_user(user) table_string = self.class.cmd_table(table) - query = "REVOKE ALL ON #{table_string} FROM #{user_string}" - mysql([defaults_file, '-e', query].compact) # revoke grant option needs to be a extra query, because # "REVOKE ALL PRIVILEGES, GRANT OPTION [..]" is only valid mysql syntax # if no ON clause is used. + # It hast to be executed before "REVOKE ALL [..]" since a GRANT has to + # exist to be executed successfully query = "REVOKE GRANT OPTION ON #{table_string} FROM #{user_string}" mysql([defaults_file, '-e', query].compact) + query = "REVOKE ALL ON #{table_string} FROM #{user_string}" + mysql([defaults_file, '-e', query].compact) end def destroy