Class: Bosh::Director::DeploymentPlan::InstancePlanFactory
- Defined in:
- lib/bosh/director/deployment_plan/instance_plan_factory.rb
Instance Method Summary collapse
- #desired_existing_instance_plan(existing_instance_model, desired_instance) ⇒ Object
- #desired_new_instance_plan(desired_instance) ⇒ Object
-
#initialize(instance_repo, states_by_existing_instance, skip_drain_decider, index_assigner, network_reservation_repository, options = {}) ⇒ InstancePlanFactory
constructor
A new instance of InstancePlanFactory.
- #obsolete_instance_plan(existing_instance_model) ⇒ Object
Constructor Details
#initialize(instance_repo, states_by_existing_instance, skip_drain_decider, index_assigner, network_reservation_repository, options = {}) ⇒ InstancePlanFactory
Returns a new instance of InstancePlanFactory.
5 6 7 8 9 10 11 12 |
# File 'lib/bosh/director/deployment_plan/instance_plan_factory.rb', line 5 def initialize(instance_repo, states_by_existing_instance, skip_drain_decider, index_assigner, network_reservation_repository, = {}) @instance_repo = instance_repo @skip_drain_decider = skip_drain_decider @recreate_deployment = .fetch('recreate', false) @states_by_existing_instance = states_by_existing_instance @index_assigner = index_assigner @network_reservation_repository = network_reservation_repository end |
Instance Method Details
#desired_existing_instance_plan(existing_instance_model, desired_instance) ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/bosh/director/deployment_plan/instance_plan_factory.rb', line 26 def desired_existing_instance_plan(existing_instance_model, desired_instance) existing_instance_state = instance_state(existing_instance_model) desired_instance.index = @index_assigner.assign_index(desired_instance.job.name, existing_instance_model) instance = @instance_repo.fetch_existing(existing_instance_model, existing_instance_state, desired_instance.job, desired_instance.index, desired_instance.deployment) instance.update_description InstancePlan.new( desired_instance: desired_instance, existing_instance: existing_instance_model, instance: instance, skip_drain: @skip_drain_decider.for_job(desired_instance.job.name), recreate_deployment: @recreate_deployment ) end |
#desired_new_instance_plan(desired_instance) ⇒ Object
41 42 43 44 45 46 47 48 49 50 51 52 |
# File 'lib/bosh/director/deployment_plan/instance_plan_factory.rb', line 41 def desired_new_instance_plan(desired_instance) desired_instance.index = @index_assigner.assign_index(desired_instance.job.name) instance = @instance_repo.create(desired_instance, desired_instance.index) InstancePlan.new( desired_instance: desired_instance, existing_instance: nil, instance: instance, skip_drain: @skip_drain_decider.for_job(desired_instance.job.name), recreate_deployment: @recreate_deployment ) end |
#obsolete_instance_plan(existing_instance_model) ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/bosh/director/deployment_plan/instance_plan_factory.rb', line 14 def obsolete_instance_plan(existing_instance_model) existing_instance_state = instance_state(existing_instance_model) @network_reservation_repository.fetch_network_reservations(existing_instance_model, existing_instance_state) InstancePlan.new( desired_instance: nil, existing_instance: existing_instance_model, instance: nil, skip_drain: @skip_drain_decider.for_job(existing_instance_model.job), recreate_deployment: @recreate_deployment ) end |