Skip to content

Commit b6deb6a

Browse files
committed
Fix a crash when we can't connect to PG
MSP-11061 No Postgres, no cry
1 parent 5fac151 commit b6deb6a

File tree

2 files changed

+0
-30
lines changed

2 files changed

+0
-30
lines changed

lib/metasploit/framework/command/base.rb

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -60,11 +60,6 @@ def self.require_environment!
6060
# the configuration from the parsed options.
6161
parsed_options.configure(Rails.application)
6262

63-
# support disabling the database
64-
unless parsed_options.options.database.disable
65-
Metasploit::Framework::Require.optionally_active_record_railtie
66-
end
67-
6863
Rails.application.require_environment!
6964

7065
parsed_options

lib/metasploit/framework/require.rb

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -34,31 +34,6 @@ def self.optionally(name, without_warning)
3434
end
3535
end
3636

37-
# Tries to `require 'active_record/railtie'` to define the activerecord Rails initializers and rake tasks.
38-
#
39-
# @example Optionally requiring 'active_record/railtie'
40-
# require 'metasploit/framework/require'
41-
#
42-
# class MyClass
43-
# def setup
44-
# if database_enabled
45-
# Metasploit::Framework::Require.optionally_active_record_railtie
46-
# end
47-
# end
48-
# end
49-
#
50-
# @return [void]
51-
def self.optionally_active_record_railtie
52-
if ::File.exist?(Rails.application.config.paths['config/database'].first)
53-
optionally(
54-
'active_record/railtie',
55-
'activerecord not in the bundle, so database support will be disabled.'
56-
)
57-
else
58-
warn 'Could not find database.yml, so database support will be disabled.'
59-
end
60-
end
61-
6237
# Tries to `require 'metasploit/credential/creation'` and include it in the `including_module`.
6338
#
6439
# @param including_module [Module] `Class` or `Module` that wants to `include Metasploit::Credential::Creation`.

0 commit comments

Comments
 (0)