Class: Bosh::Director::Errand::JobManager
- Defined in:
- lib/bosh/director/errand/job_manager.rb
Instance Method Summary collapse
- #create_missing_vms ⇒ Object
-
#delete_instances ⇒ void
Deletes all errand job instances.
-
#initialize(deployment, job, cloud, logger) ⇒ JobManager
constructor
A new instance of JobManager.
-
#update_instances ⇒ void
Creates/updates all errand job instances.
Constructor Details
#initialize(deployment, job, cloud, logger) ⇒ JobManager
Returns a new instance of JobManager.
7 8 9 10 11 12 13 14 15 16 |
# File 'lib/bosh/director/errand/job_manager.rb', line 7 def initialize(deployment, job, cloud, logger) @deployment = deployment @job = job @logger = logger vm_deleter = Bosh::Director::VmDeleter.new(cloud, logger, false, Config.enable_virtual_delete_vms) @disk_manager = DiskManager.new(cloud, logger) @job_renderer = JobRenderer.create arp_flusher = ArpFlusher.new @vm_creator = Bosh::Director::VmCreator.new(cloud, logger, vm_deleter, @disk_manager, @job_renderer, arp_flusher) end |
Instance Method Details
#create_missing_vms ⇒ Object
18 19 20 |
# File 'lib/bosh/director/errand/job_manager.rb', line 18 def create_missing_vms @vm_creator.create_for_instance_plans(@job.instance_plans_with_missing_vms, @deployment.ip_provider) end |
#delete_instances ⇒ void
This method returns an undefined value.
Deletes all errand job instances
32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/bosh/director/errand/job_manager.rb', line 32 def delete_instances instance_plans = bound_instance_plans if instance_plans.empty? @logger.info('No errand instances to delete') return end @logger.info('Deleting errand instances') event_log_stage = Config.event_log.begin_stage('Deleting errand instances', instance_plans.size, [@job.name]) dns_manager = DnsManagerProvider.create instance_deleter = InstanceDeleter.new(@deployment.ip_provider, dns_manager, @disk_manager) instance_deleter.delete_instance_plans(instance_plans, event_log_stage) end |
#update_instances ⇒ void
This method returns an undefined value.
Creates/updates all errand job instances
24 25 26 27 28 |
# File 'lib/bosh/director/errand/job_manager.rb', line 24 def update_instances links_resolver = DeploymentPlan::LinksResolver.new(@deployment, @logger) job_updater = JobUpdater.new(@deployment, @job, links_resolver, @disk_manager) job_updater.update end |