Rename restart_pending to pending_restart for compatibility

This commit is contained in:
Alexander Kukushkin
2016-06-02 09:31:30 +02:00
parent 2d78ef0922
commit ebb9e252d8
5 changed files with 11 additions and 11 deletions
+1 -1
View File
@@ -33,7 +33,7 @@ Scenario: check dynamic configuration change via DCS
Given I issue a PATCH request to http://127.0.0.1:8008/config with {"ttl": 20, "loop_wait": 1, "postgresql": {"parameters": {"max_connections": 101}}}
Then I receive a response code 200
And I receive a response loop_wait 1
And Response on GET http://127.0.0.1:8008/patroni contains restart_pending after 11 seconds
And Response on GET http://127.0.0.1:8008/patroni contains pending_restart after 11 seconds
When I issue a GET request to http://127.0.0.1:8008/config
Then I receive a response code 200
And I receive a response loop_wait 1
+2 -2
View File
@@ -60,8 +60,8 @@ class RestApiHandler(BaseHTTPRequestHandler):
response.update({'tags': patroni.tags} if patroni.tags else {})
if patroni.postgresql.sysid:
response['database_system_identifier'] = patroni.postgresql.sysid
if patroni.postgresql.restart_pending:
response['restart_pending'] = True
if patroni.postgresql.pending_restart:
response['pending_restart'] = True
response['patroni'] = {'version': patroni.version, 'scope': patroni.postgresql.scope}
self._write_json_response(status_code, response)
+2 -2
View File
@@ -59,8 +59,8 @@ class Ha(object):
}
if self.patroni.tags:
data['tags'] = self.patroni.tags
if self.state_handler.restart_pending:
data['restart_pending'] = True
if self.state_handler.pending_restart:
data['pending_restart'] = True
if not self._async_executor.busy and data['state'] in ['running', 'restarting', 'starting']:
try:
data['xlog_location'] = self.state_handler.xlog_position()
+5 -5
View File
@@ -64,7 +64,7 @@ class Postgresql(object):
self.name = config['name']
self.scope = config['scope']
self._data_dir = config['data_dir']
self._restart_pending = False
self._pending_restart = False
self._server_parameters = self.get_server_parameters(config)
self._connect_address = config.get('connect_address')
@@ -148,7 +148,7 @@ class Postgresql(object):
if server_parameters[r[0]] is None or str(server_parameters[r[0]]) != str(r[1]):
reload_pending = True
if r[2] in ('internal', 'postmaster'):
self._restart_pending = True
self._pending_restart = True
if r[0] in ('listen_addresses', 'port'):
listen_address_changed = True
self.config = config
@@ -164,8 +164,8 @@ class Postgresql(object):
self.retry.deadline = config['retry_timeout']/2.0
@property
def restart_pending(self):
return self._restart_pending
def pending_restart(self):
return self._pending_restart
@property
def can_rewind(self):
@@ -454,7 +454,7 @@ class Postgresql(object):
if not (self._major_version < 9.4 and p in ('max_replication_slots', 'wal_log_hints')))
ret = subprocess.call(self._pg_ctl + ['start', '-o', options], env=env, preexec_fn=os.setsid) == 0
self._restart_pending = False
self._pending_restart = False
self.set_state('running' if ret else 'start failed')
if ret:
+1 -1
View File
@@ -18,7 +18,7 @@ class MockPostgresql(object):
server_version = '999999'
sysid = 'dummysysid'
scope = 'dummy'
restart_pending = True
pending_restart = True
@staticmethod
def connection():