Raise an error when http service fails to connect

Also fix a bug where failed Postgres connections werent being raised
GSoC/Meterpreter_Web_Console
James Barnett 2018-09-02 15:51:13 -05:00
parent b4c731d4ca
commit 1c8a2f3ee1
No known key found for this signature in database
GPG Key ID: 647983861A4EC5EA
1 changed files with 2 additions and 2 deletions

View File

@ -2042,7 +2042,7 @@ class Db
opts['host'] = '127.0.0.1'
end
if framework.db.connect(opts)
if framework.db.connect(opts) && framework.db.connection_established?
print_line "Connected to Postgres data service: #{info[:host]}/#{info[:name]}"
else
raise RuntimeError.new("Failed to connect to the Postgres data service: #{framework.db.error}")
@ -2064,7 +2064,7 @@ class Db
print_line "Connected to HTTP data service: #{remote_data_service.name}"
framework.db.workspace = framework.db.default_workspace
rescue => e
print_error "There was a problem connecting to the HTTP data service: #{e.message}"
raise RuntimeError.new("Failed to connect to the HTTP data service: #{e.message}")
end
end