__mysql_privileges: fix quoting
This commit is contained in:
parent
bcefeb240c
commit
710e99f240
2 changed files with 8 additions and 3 deletions
|
@ -30,7 +30,7 @@ host="$( cat "$__object/parameter/host" )"
|
|||
|
||||
check_privileges="$(
|
||||
mysql -B -N -e "show grants for '$user'@'$host'" \
|
||||
| grep -Ei "^grant $privileges on .$database.\..$table. to " || true )"
|
||||
| grep -Ei "^grant $privileges on .$database.\..?$table.? to " || true )"
|
||||
|
||||
if [ -n "$check_privileges" ]
|
||||
then
|
||||
|
|
|
@ -37,13 +37,18 @@ user="$( cat "$__object/parameter/user" )"
|
|||
|
||||
host="$( cat "$__object/parameter/host" )"
|
||||
|
||||
if [ "$table" != '*' ]
|
||||
then
|
||||
table="$( printf '`%s`' "$table" )"
|
||||
fi
|
||||
|
||||
case "$state_should" in
|
||||
present)
|
||||
echo "mysql -e 'grant $privileges on \`$database\`.\`$table\` to \`$user\`@\`$host\`'"
|
||||
echo "mysql -e 'grant $privileges on \`$database\`.$table to \`$user\`@\`$host\`'"
|
||||
echo "grant $privileges on $database.$table to $user@$host" >> "$__messages_out"
|
||||
;;
|
||||
absent)
|
||||
echo "mysql -e 'revoke $privileges on \`$database\`.\`$table\` from \`$user\`@\`$host\`'"
|
||||
echo "mysql -e 'revoke $privileges on \`$database\`.$table from \`$user\`@\`$host\`'"
|
||||
echo "revoke $privileges on $database.$table from $user@$host" >> "$__messages_out"
|
||||
;;
|
||||
esac
|
||||
|
|
Loading…
Reference in a new issue