Class: Bosh::Director::DeploymentPlan::LinkLookupFactory

Inherits:
Object
  • Object
show all
Defined in:
lib/bosh/director/deployment_plan/links/link_lookup.rb

Overview

tested in link_resolver_spec

Class Method Summary collapse

Class Method Details

.create(consumed_link, link_path, deployment_plan, link_network) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/bosh/director/deployment_plan/links/link_lookup.rb', line 6

def self.create(consumed_link, link_path, deployment_plan, link_network)
  if link_path.deployment == deployment_plan.name
    PlannerLinkLookup.new(consumed_link, link_path, deployment_plan, link_network)
  else
    deployment = Models::Deployment.find(name: link_path.deployment)
    unless deployment
      raise DeploymentInvalidLink, "Link '#{consumed_link}' references unknown deployment '#{link_path.deployment}'"
    end
    
    DeploymentLinkSpecLookup.new(consumed_link, link_path, deployment.link_spec, link_network)
  end
end