@@ -89,7 +89,7 @@ def run_simple(opts = {}, &block)
8989 #
9090 # Job run proc, sets up the module and kicks it off.
9191 #
92- # XXX: Mostly Copy/pasted from simple/auxiliarly .rb
92+ # XXX: Mostly Copy/pasted from simple/auxiliary .rb
9393 #
9494 def self . job_run_proc ( ctx )
9595 mod = ctx [ 0 ]
@@ -99,9 +99,15 @@ def self.job_run_proc(ctx)
9999 # Grab the session object since we need to fire an event for not
100100 # only the normal module_run event that all module types have to
101101 # report, but a specific event for sessions as well.
102- s = mod . framework . sessions . get ( mod . datastore [ "SESSION" ] . to_i )
103- mod . framework . events . on_session_module_run ( s , mod )
104- mod . run
102+ s = mod . framework . sessions . get ( mod . datastore [ "SESSION" ] )
103+ if s
104+ mod . framework . events . on_session_module_run ( s , mod )
105+ mod . run
106+ else
107+ mod . print_error ( "Session not found" )
108+ mod . cleanup
109+ return
110+ end
105111 rescue ::Timeout ::Error => e
106112 mod . error = e
107113 mod . print_error ( "Post triggered a timeout exception" )
@@ -135,7 +141,7 @@ def self.job_run_proc(ctx)
135141 #
136142 # Clean up the module after the job completes.
137143 #
138- # Copy/pasted from simple/auxiliarly .rb
144+ # Copy/pasted from simple/auxiliary .rb
139145 #
140146 def self . job_cleanup_proc ( ctx )
141147 mod = ctx [ 0 ]
0 commit comments