Method: Bosh::Director::Jobs::UpdateRelease#process_jobs
- Defined in:
- lib/bosh/director/jobs/update_release.rb
#process_jobs ⇒ void
This method returns an undefined value.
Finds job template definitions in release manifest and sorts them into two buckets: new and existing job templates, then creates new job template records in the database and points release version to existing ones.
387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 |
# File 'lib/bosh/director/jobs/update_release.rb', line 387 def process_jobs logger.info("Checking for new jobs in release") new_jobs = [] existing_jobs = [] @manifest["jobs"].each do || filter = {:sha1 => ["sha1"]} if ["fingerprint"] filter[:fingerprint] = ["fingerprint"] filter = filter.sql_or end # Checking whether we might have the same bits somewhere jobs = Models::Template.where(filter).all if @rebase substitutes = jobs.select do |job| job.release_id == @release_model.id && job.name == ["name"] end substitute = pick_best(substitutes, ["version"]) if substitute ["version"] = substitute.version ["sha1"] = substitute.sha1 existing_jobs << [substitute, ] else new_jobs << end next end template = jobs.find do |job| job.release_id == @release_model.id && job.name == ["name"] && job.version == ["version"] end if template.nil? new_jobs << else existing_jobs << [template, ] end end create_jobs(new_jobs) use_existing_jobs(existing_jobs) end |