mirror of
https://github.com/valitydev/salt.git
synced 2024-11-07 08:58:59 +00:00
salt.modules.postgres: Quote all extension work
- Fix regressions in tests introduced by @ticosax (nevermind @ticosax i also regulary breaks them :p) - Quote also alters.
This commit is contained in:
parent
2bacf994fa
commit
b62c680b81
@ -1249,10 +1249,10 @@ def create_extension(name,
|
||||
else:
|
||||
args = []
|
||||
if schema and _EXTENSION_TO_MOVE in mtdata:
|
||||
args.append('ALTER EXTENSION {0} SET SCHEMA {1};'.format(
|
||||
args.append('ALTER EXTENSION "{0}" SET SCHEMA {1};'.format(
|
||||
name, schema))
|
||||
if ext_version and _EXTENSION_TO_UPGRADE in mtdata:
|
||||
args.append('ALTER EXTENSION {0} UPDATE TO {1};'.format(
|
||||
args.append('ALTER EXTENSION "{0}" UPDATE TO {1};'.format(
|
||||
name, ext_version))
|
||||
cmd = ' '.join(args).strip()
|
||||
if cmd:
|
||||
|
@ -621,30 +621,30 @@ class PostgresTestCase(TestCase):
|
||||
'''
|
||||
self.assertTrue(postgres.create_extension('foo'))
|
||||
self.assertTrue(re.match(
|
||||
'CREATE EXTENSION IF NOT EXISTS foo ;',
|
||||
'CREATE EXTENSION IF NOT EXISTS "foo" ;',
|
||||
postgres._psql_prepare_and_run.call_args[0][0][1]))
|
||||
self.assertTrue(postgres.create_extension(
|
||||
'foo', schema='a', ext_version='b', from_version='c'))
|
||||
self.assertTrue(re.match(
|
||||
'CREATE EXTENSION IF NOT EXISTS foo '
|
||||
'CREATE EXTENSION IF NOT EXISTS "foo" '
|
||||
'WITH SCHEMA a VERSION b FROM c ;',
|
||||
postgres._psql_prepare_and_run.call_args[0][0][1]))
|
||||
self.assertFalse(postgres.create_extension('foo'))
|
||||
ret = postgres.create_extension('foo', ext_version='a', schema='b')
|
||||
self.assertTrue(ret)
|
||||
self.assertTrue(re.match(
|
||||
'ALTER EXTENSION foo SET SCHEMA b;'
|
||||
' ALTER EXTENSION foo UPDATE TO a;',
|
||||
'ALTER EXTENSION "foo" SET SCHEMA b;'
|
||||
' ALTER EXTENSION "foo" UPDATE TO a;',
|
||||
postgres._psql_prepare_and_run.call_args[0][0][1]))
|
||||
ret = postgres.create_extension('foo', ext_version='a', schema='b')
|
||||
self.assertTrue(ret)
|
||||
self.assertTrue(re.match(
|
||||
'ALTER EXTENSION foo SET SCHEMA b;',
|
||||
'ALTER EXTENSION "foo" SET SCHEMA b;',
|
||||
postgres._psql_prepare_and_run.call_args[0][0][1]))
|
||||
ret = postgres.create_extension('foo', ext_version='a', schema='b')
|
||||
self.assertTrue(ret)
|
||||
self.assertTrue(re.match(
|
||||
'ALTER EXTENSION foo UPDATE TO a;',
|
||||
'ALTER EXTENSION "foo" UPDATE TO a;',
|
||||
postgres._psql_prepare_and_run.call_args[0][0][1]))
|
||||
self.assertFalse(postgres.create_extension(
|
||||
'foo', ext_version='a', schema='b'))
|
||||
|
Loading…
Reference in New Issue
Block a user