Address codacy and travis issues

This commit is contained in:
Alexander Kukushkin
2016-05-25 14:49:33 +02:00
parent 7827951c8c
commit ceace03646
3 changed files with 5 additions and 4 deletions
+2 -2
View File
@@ -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
+2 -1
View File
@@ -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})
+1 -1
View File
@@ -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))