Escape brackets in postgres modules as well

Fixes #2279
This commit is contained in:
Jonas 2012-10-19 10:17:22 +02:00
parent 8c3fadf15e
commit e6c4e4649b

View File

@ -14,6 +14,7 @@ might look like::
This data can also be passed into pillar. Options passed into opts will This data can also be passed into pillar. Options passed into opts will
overwrite options passed into pillar overwrite options passed into pillar
''' '''
import re
import logging import logging
from salt.utils import check_or_die from salt.utils import check_or_die
from salt.exceptions import CommandNotFoundError from salt.exceptions import CommandNotFoundError
@ -62,7 +63,7 @@ def _connection_defaults(user=None, host=None, port=None):
return (user, host, port) return (user, host, port)
def _quote(s): def _quote(s):
r = s.replace("'", r"\'").replace('"', r'\"') r = re.sub('([\'\"()])', r'\\\1', s)
if ' ' in s: if ' ' in s:
r = "'%s'" % r r = "'%s'" % r
return r return r