support 'owner' argument to tablespace_create

This commit is contained in:
Jon Nelson 2016-07-11 19:13:48 -05:00
parent 9b5526a680
commit 278c2e4ce8

View file

@ -174,7 +174,7 @@ def tablespace_exists(name, user=None, host=None, port=None, maintenance_db=None
return name in tablespaces return name in tablespaces
def tablespace_create(name, location, user=None, host=None, port=None, def tablespace_create(name, location, owner=None, user=None, host=None, port=None,
maintenance_db=None, password=None, runas=None): maintenance_db=None, password=None, runas=None):
''' '''
Adds a tablespace to the Postgres server. Adds a tablespace to the Postgres server.
@ -186,6 +186,8 @@ def tablespace_create(name, location, user=None, host=None, port=None,
salt '*' postgres_ext.tablespace_create tablespacename '/path/datadir' salt '*' postgres_ext.tablespace_create tablespacename '/path/datadir'
''' '''
query = 'CREATE TABLESPACE {0} LOCATION \'{1}\''.format(name, location) query = 'CREATE TABLESPACE {0} LOCATION \'{1}\''.format(name, location)
if owner is not None:
query += ' OWNER \'{1}\''.format(owner)
# Execute the command # Execute the command
ret = _psql_prepare_and_run(['-c', query], ret = _psql_prepare_and_run(['-c', query],
@ -252,3 +254,4 @@ def tablespace_remove(name, user=None, host=None, port=None,
maintenance_db=maintenance_db, maintenance_db=maintenance_db,
password=password) password=password)
return ret['retcode'] == 0 return ret['retcode'] == 0