Check that DB is active before looking up payload

master
Matthew Kienow 2019-03-06 14:22:32 -05:00
parent 6bcdda4bd1
commit f873d94c10
No known key found for this signature in database
GPG Key ID: 40787F8B1EAC6E41
1 changed files with 14 additions and 10 deletions

View File

@ -224,16 +224,20 @@ protected
# Pass along any associated payload uuid if specified
if opts[:payload_uuid]
s.payload_uuid = opts[:payload_uuid]
payload_info = {
uuid: s.payload_uuid.puid_hex,
workspace: framework.db.workspace
}
if s.payload_uuid.respond_to?(:puid_hex) && (uuid_info = framework.db.payloads(payload_info).first)
s.payload_uuid.registered = true
s.payload_uuid.name = uuid_info['name']
s.payload_uuid.timestamp = uuid_info['timestamp']
else
s.payload_uuid.registered = false
s.payload_uuid.registered = false
if framework.db.active
payload_info = {
uuid: s.payload_uuid.puid_hex,
workspace: framework.db.workspace
}
if s.payload_uuid.respond_to?(:puid_hex) && (uuid_info = framework.db.payloads(payload_info).first)
s.payload_uuid.registered = true
s.payload_uuid.name = uuid_info['name']
s.payload_uuid.timestamp = uuid_info['timestamp']
else
s.payload_uuid.registered = false
end
end
end