Skip to content

Commit c73bffa

Browse files
authored
Merge pull request #20257 from cgranleese-r7/fixes-deprecation-error
Fixes an error in `report_note` deprecation message
2 parents 02d7a23 + bae1a3e commit c73bffa

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

lib/msf/core/db_manager/note.rb

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -145,9 +145,10 @@ def report_note(opts)
145145
ntype = opts.delete(:type) || opts.delete(:ntype) || (raise RuntimeError, "A note :type or :ntype is required")
146146

147147
unless opts[:data].is_a?(Hash)
148-
message = "[DEPRECATION] Using #{method.inspect} with a non-hash data value is deprecated, please raise a Github issue with this output. Called from: #{caller(1, stack_size).to_a}"
149-
print_warning message
150-
# Additionally write to ~/.msf4/logs/framework.log - as this gets attached to Github issues etc
148+
stack_trace = caller.map { |line| "[-] #{line}" }.join("\n")
149+
message = "\n[-] [DEPRECATION] Using #{__method__} with a non-hash data value is deprecated, please raise a Github issue with this output.\n[-] Call stack:\n#{stack_trace}"
150+
warn(message)
151+
# Additionally write to ~/.msf4/logs/framework.log - as this gets attached to GitHub issues etc
151152
elog(message)
152153
end
153154

0 commit comments

Comments
 (0)