Class: Bosh::Director::DeploymentPlan::JobMigrator
- Defined in:
- lib/bosh/director/deployment_plan/job_migrator.rb
Instance Method Summary collapse
- #find_existing_instances(desired_job) ⇒ Object
-
#initialize(deployment_plan, logger) ⇒ JobMigrator
constructor
A new instance of JobMigrator.
Constructor Details
#initialize(deployment_plan, logger) ⇒ JobMigrator
Returns a new instance of JobMigrator.
5 6 7 8 |
# File 'lib/bosh/director/deployment_plan/job_migrator.rb', line 5 def initialize(deployment_plan, logger) @deployment_plan = deployment_plan @logger = logger end |
Instance Method Details
#find_existing_instances(desired_job) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/bosh/director/deployment_plan/job_migrator.rb', line 10 def find_existing_instances(desired_job) instances = [] existing_instances = @deployment_plan.instance_models.select { |model| model.job == desired_job.name } existing_instances.each do |existing_instance| instances << existing_instance end unless desired_job.migrated_from.to_a.empty? migrated_from_instances = all_migrated_from_instances( desired_job.migrated_from, desired_job ) instances += migrated_from_instances end instances.uniq end |