Check for the connection status before executing the statement for

checking the 'server in recovery' information.

Thanks Khushboo for reporting the issue.
pull/3/head
Murtuza Zabuawala 2016-05-12 13:22:13 +05:30 committed by Ashesh Vashi
parent 7f790a7f49
commit 40a9490382
1 changed files with 9 additions and 7 deletions

View File

@ -69,13 +69,15 @@ class ServerModule(sg.ServerGroupPluginModule):
manager = driver.connection_manager(server.id)
conn = manager.connection()
connected = conn.connected()
status, in_recovery = conn.execute_scalar("""
SELECT CASE WHEN usesuper
THEN pg_is_in_recovery()
ELSE FALSE
END as inrecovery
FROM pg_user WHERE usename=current_user""")
if connected:
status, in_recovery = conn.execute_scalar("""
SELECT CASE WHEN usesuper
THEN pg_is_in_recovery()
ELSE FALSE
END as inrecovery
FROM pg_user WHERE usename=current_user""")
else:
in_recovery = None
yield self.generate_browser_node(
"%d" % (server.id),