Fix invalid session ID bug

This fix should work seamlessly with #2952.
bug/bundler_fix
William Vu 2014-02-11 04:13:05 -06:00
parent 1f0020a61c
commit 2476d9be2d
1 changed files with 10 additions and 3 deletions

View File

@ -93,15 +93,22 @@ protected
# #
def self.job_run_proc(ctx) def self.job_run_proc(ctx)
mod = ctx[0] mod = ctx[0]
sid = mod.datastore["SESSION"]
begin begin
mod.setup mod.setup
mod.framework.events.on_module_run(mod) mod.framework.events.on_module_run(mod)
# Grab the session object since we need to fire an event for not # Grab the session object since we need to fire an event for not
# only the normal module_run event that all module types have to # only the normal module_run event that all module types have to
# report, but a specific event for sessions as well. # report, but a specific event for sessions as well.
s = mod.framework.sessions[mod.datastore["SESSION"]] s = mod.framework.sessions.get(sid)
mod.framework.events.on_session_module_run(s, mod) if s
mod.run mod.framework.events.on_session_module_run(s, mod)
mod.run
else
mod.print_error("Invalid session ID: #{sid}")
mod.cleanup
return
end
rescue ::Timeout::Error => e rescue ::Timeout::Error => e
mod.error = e mod.error = e
mod.print_error("Post triggered a timeout exception") mod.print_error("Post triggered a timeout exception")