Method: Rex::JobContainer#add_job

Defined in:
lib/rex/job_container.rb

#add_job(name, ctx, run_proc, clean_proc) ⇒ Object

Adds an already running task as a symbolic job to the container.



115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
# File 'lib/rex/job_container.rb', line 115

def add_job(name, ctx, run_proc, clean_proc)
  real_name = name
  count     = 0
  jid       = job_id_pool

  self.job_id_pool += 1

  # If we were not supplied with a job name, pick one from the hat
  if (real_name == nil)
    real_name = '#' + jid.to_s
  end

  # Find a unique job name
  while (j = self[real_name])
    real_name  = name + " #{count}"
    count     += 1
  end

  j = Job.new(self, jid, real_name, ctx, run_proc, clean_proc)

  self[jid.to_s] = j
end