Class: Bosh::Director::Errand::JobManager
- Defined in:
- lib/bosh/director/errand/job_manager.rb
Instance Method Summary collapse
-
#delete_instances ⇒ void
Deletes created all job instances.
-
#initialize(deployment, job, blobstore, event_log) ⇒ JobManager
constructor
A new instance of JobManager.
-
#update_instances ⇒ void
Creates/updates all job instances.
Constructor Details
#initialize(deployment, job, blobstore, event_log) ⇒ JobManager
Returns a new instance of JobManager.
7 8 9 10 11 12 |
# File 'lib/bosh/director/errand/job_manager.rb', line 7 def initialize(deployment, job, blobstore, event_log) @deployment = deployment @job = job @blobstore = blobstore @event_log = event_log end |
Instance Method Details
#delete_instances ⇒ void
This method returns an undefined value.
Deletes created all job instances
32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/bosh/director/errand/job_manager.rb', line 32 def delete_instances instances = @job.instances.map(&:model).compact return if instances.empty? event_log_stage = @event_log.begin_stage( 'Deleting instances', instances.size, [@job.name]) instance_deleter = InstanceDeleter.new(@deployment) instance_deleter.delete_instances(instances, event_log_stage) deallocate_vms end |
#update_instances ⇒ void
This method returns an undefined value.
Creates/updates all job instances
16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/bosh/director/errand/job_manager.rb', line 16 def update_instances dns_binder = DeploymentPlan::DnsBinder.new(@deployment) dns_binder.bind_deployment instance_vm_binder = DeploymentPlan::InstanceVmBinder.new(@event_log) instance_vm_binder.bind_instance_vms(@job.instances) job_renderer = JobRenderer.new(@job, @blobstore) job_renderer.render_job_instances job_updater = JobUpdater.new(@deployment, @job, job_renderer) job_updater.update end |