class Bosh::Director::DeploymentPlan::LinkLookupFactory

tested in link_resolver_spec

Public Class Methods

create(consumed_link, link_path, deployment_plan, link_network) click to toggle source
# 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