Add missing ActiveRecord connection block

master
Matthew Kienow 2019-03-06 13:07:35 -05:00
parent b658cf5d76
commit a749b86730
No known key found for this signature in database
GPG Key ID: 40787F8B1EAC6E41
1 changed files with 7 additions and 5 deletions

View File

@ -1,13 +1,15 @@
module Msf::DBManager::Payload
def create_payload(opts)
if opts[:uuid] && !opts[:uuid].to_s.empty?
if Mdm::Payload.find_by(uuid: opts[:uuid])
raise ArgumentError.new("A payload with this uuid already exists.")
::ActiveRecord::Base.connection_pool.with_connection do
if opts[:uuid] && !opts[:uuid].to_s.empty?
if Mdm::Payload.find_by(uuid: opts[:uuid])
raise ArgumentError.new("A payload with this uuid already exists.")
end
end
end
Mdm::Payload.create!(opts)
Mdm::Payload.create!(opts)
end
end
def payloads(opts)