Skip to content

Commit

Permalink
(MODULES-1330) Change order of revokation
Browse files Browse the repository at this point in the history
  • Loading branch information
fnerdwq committed Sep 16, 2014
1 parent fbef97d commit bbbc6cd
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lib/puppet/provider/mysql_grant/mysql.rb
Original file line number Diff line number Diff line change
Expand Up @@ -89,13 +89,15 @@ def revoke(user, table)
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
Expand Down

0 comments on commit bbbc6cd

Please sign in to comment.