Simplify the condition when handling postgresql status request failures.

This commit is contained in:
Oleksii Kliukin
2015-11-23 12:59:01 +01:00
parent e6b6086e31
commit e3961ee70b
+3 -4
View File
@@ -242,10 +242,9 @@ class RestApiHandler(BaseHTTPRequestHandler):
}
except (psycopg2.Error, RetryFailedError, PostgresConnectionException):
state = self.server.patroni.postgresql.state
if state in ['stopped', 'starting', 'stopping', 'restarting', 'running']:
if state == 'running':
logger.exception('get_postgresql_status')
state = 'unknown' if state == 'running' else state
if state == 'running':
logger.exception('get_postgresql_status')
state = 'unknown'
return {'state': state}
def get_tags(self):