Class: Bosh::Director::Jobs::ExportRelease
- Includes:
- LockHelper
- Defined in:
- lib/bosh/director/jobs/export_release.rb
Instance Attribute Summary
Attributes inherited from BaseJob
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(deployment_name, release_name, release_version, stemcell_os, stemcell_version, options = {}) ⇒ ExportRelease
constructor
A new instance of ExportRelease.
- #perform ⇒ void
Methods included from LockHelper
#with_compile_lock, #with_deployment_lock, #with_release_lock, #with_release_locks, #with_stemcell_lock
Methods inherited from BaseJob
#begin_stage, #dns_manager, #event_manager, #logger, perform, #result_file, schedule_message, #single_step_stage, #task_cancelled?, #task_checkpoint, #track_and_log, #username
Constructor Details
#initialize(deployment_name, release_name, release_version, stemcell_os, stemcell_version, options = {}) ⇒ ExportRelease
Returns a new instance of ExportRelease.
19 20 21 22 23 24 25 |
# File 'lib/bosh/director/jobs/export_release.rb', line 19 def initialize(deployment_name, release_name, release_version, stemcell_os, stemcell_version, = {}) @deployment_name = deployment_name @release_name = release_name @release_version = release_version @stemcell_os = stemcell_os @stemcell_version = stemcell_version end |
Class Method Details
.job_type ⇒ Object
15 16 17 |
# File 'lib/bosh/director/jobs/export_release.rb', line 15 def self.job_type :export_release end |
Instance Method Details
#perform ⇒ void
This method returns an undefined value.
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 |
# File 'lib/bosh/director/jobs/export_release.rb', line 28 def perform logger.info("Exporting release: #{@release_name}/#{@release_version} for #{@stemcell_os}/#{@stemcell_version}") deployment_plan_stemcell = Bosh::Director::DeploymentPlan::Stemcell.parse({ "os" => @stemcell_os, "version" => @stemcell_version }) deployment_manager = Bosh::Director::Api::DeploymentManager.new targeted_deployment = deployment_manager.find_by_name(@deployment_name) release_manager = Bosh::Director::Api::ReleaseManager.new release = release_manager.find_by_name(@release_name) release_version_model = release_manager.find_version(release, @release_version) unless deployment_manifest_has_release?(targeted_deployment.manifest) raise ReleaseNotMatchingManifest, "Release version '#{@release_name}/#{@release_version}' not found in deployment '#{@deployment_name}' manifest" end planner_factory = DeploymentPlan::PlannerFactory.create(logger) planner = planner_factory.create_from_model(targeted_deployment) deployment_plan_stemcell.bind_model(planner.model) stemcell_model = deployment_plan_stemcell.model logger.info "Will compile with stemcell: #{stemcell_model.desc}" release = planner.release(@release_name) export_release_job = create_job_with_all_the_templates_so_everything_compiles(release_version_model, release, planner, deployment_plan_stemcell) planner.add_instance_group(export_release_job) planner.bind_models(true) lock_timeout = 15 * 60 # 15 minutes with_deployment_lock(@deployment_name, :timeout => lock_timeout) do with_release_lock(@release_name, :timeout => lock_timeout) do with_stemcell_lock(stemcell_model.name, stemcell_model.version, :timeout => lock_timeout) do planner.compile_packages tarball_state = create_tarball(release_version_model, stemcell_model) result_file.write(tarball_state.to_json + "\n") end end end "Exported release: #{@release_name}/#{@release_version} for #{@stemcell_os}/#{@stemcell_version}" end |