mirror of
https://github.com/outbackdingo/patroni.git
synced 2026-08-25 14:53:37 +00:00
Address codacy and travis issues
This commit is contained in:
@@ -110,7 +110,7 @@ class PatroniController(AbstractController):
|
||||
patroni_config_path = os.path.join(self._output_dir, patroni_config_name)
|
||||
|
||||
with open(patroni_config_name) as f:
|
||||
config = yaml.load(f)
|
||||
config = yaml.safe_load(f)
|
||||
|
||||
host = config['postgresql']['listen'].split(':')[0]
|
||||
|
||||
@@ -143,7 +143,7 @@ class PatroniController(AbstractController):
|
||||
config['zookeeper'] = dcs_config
|
||||
|
||||
with open(patroni_config_path, 'w') as f:
|
||||
yaml.dump(config, f, default_flow_style=False)
|
||||
yaml.safe_dump(config, f, default_flow_style=False)
|
||||
|
||||
return patroni_config_path
|
||||
|
||||
|
||||
@@ -120,7 +120,8 @@ class Postgresql(object):
|
||||
logger.exception('Failed to read PG_VERSION from %s', self._data_dir)
|
||||
return 0.0
|
||||
|
||||
def get_server_parameters(self, config):
|
||||
@staticmethod
|
||||
def get_server_parameters(config):
|
||||
parameters = config['parameters'].copy()
|
||||
listen_addresses, port = (config['listen'] + ':5432').split(':')[:2]
|
||||
parameters.update({'listen_addresses': listen_addresses, 'port': port})
|
||||
|
||||
@@ -14,7 +14,7 @@ class TestConfig(unittest.TestCase):
|
||||
self.config = Config(config_env='postgresql: {data_dir: foo}')
|
||||
|
||||
def test_reload_local_configuration(self):
|
||||
Config(config_file='postgres0.yml').reload_local_configuration()
|
||||
self.assertIsNone(Config(config_file='postgres0.yml').reload_local_configuration())
|
||||
|
||||
@patch('tempfile.mkstemp', Mock(return_value=[3000, 'blabla']))
|
||||
@patch('os.path.exists', Mock(return_value=True))
|
||||
|
||||
Reference in New Issue
Block a user