Class: Bosh::Director::DeploymentPlan::PlannerLinkLookup
- Defined in:
- lib/bosh/director/deployment_plan/links/link_lookup.rb
Overview
Used to find link source from deployment plan
Instance Method Summary collapse
- #find_link_spec ⇒ Object
-
#initialize(required_link, link_path, deployment_plan) ⇒ PlannerLinkLookup
constructor
A new instance of PlannerLinkLookup.
Constructor Details
#initialize(required_link, link_path, deployment_plan) ⇒ PlannerLinkLookup
Returns a new instance of PlannerLinkLookup.
24 25 26 27 28 |
# File 'lib/bosh/director/deployment_plan/links/link_lookup.rb', line 24 def initialize(required_link, link_path, deployment_plan) @required_link = required_link @link_path = link_path @jobs = deployment_plan.jobs end |
Instance Method Details
#find_link_spec ⇒ Object
30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/bosh/director/deployment_plan/links/link_lookup.rb', line 30 def find_link_spec job = @jobs.find { |j| j.name == @link_path.job } return nil unless job template = job.templates.find { |t| t.name == @link_path.template } return nil unless template found = template.provided_links.find { |p| p.name == @link_path.name && p.type == @required_link.type } return nil unless found Link.new(@link_path.name, job).spec end |