diff --git a/patroni/postgresql.py b/patroni/postgresql.py index e1e96fb2..9b51da2c 100644 --- a/patroni/postgresql.py +++ b/patroni/postgresql.py @@ -169,11 +169,8 @@ class Postgresql: @staticmethod def initdb_allowed_option(name): - allowed_options = set(['auth', 'auth-host', 'auth-local', 'encoding', 'data-checksums', - 'locale', 'lc-collate', 'lc-ctype', 'lc-messages', 'lc-monetary', - 'lc-numeric', 'lc-time', 'text-search-config', 'xlogdir', 'debug', 'noclean']) - if name not in allowed_options: - raise Exception('{} option for initdb is unknown or not allowed'.format(name)) + if name in ['pgdata', 'nosync', 'pwfile', 'sync-only']: + raise Exception('{} option for initdb is not allowed'.format(name)) return True def get_initdb_options(self): diff --git a/tests/test_postgresql.py b/tests/test_postgresql.py index 6f0e807a..3e8caf47 100644 --- a/tests/test_postgresql.py +++ b/tests/test_postgresql.py @@ -190,7 +190,7 @@ class TestPostgresql(unittest.TestCase): def test_get_initdb_options(self): self.p.initdb_options = [{'encoding': 'UTF8'}, 'data-checksums'] self.assertEquals(self.p.get_initdb_options(), ['--encoding=UTF8', '--data-checksums']) - self.p.initdb_options = [{'foo': 'bar'}] + self.p.initdb_options = [{'pgdata': 'bar'}] self.assertRaises(Exception, self.p.get_initdb_options) self.p.initdb_options = [{'foo': 'bar', 1: 2}] self.assertRaises(Exception, self.p.get_initdb_options)