Class: Bosh::Director::DeploymentPlan::LinkPath

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#deploymentObject

Returns the value of attribute deployment

Returns:

  • (Object)

    the current value of deployment



3
4
5
# File 'lib/bosh/director/deployment_plan/links/link_path.rb', line 3

def deployment
  @deployment
end

#jobObject

Returns the value of attribute job

Returns:

  • (Object)

    the current value of job



3
4
5
# File 'lib/bosh/director/deployment_plan/links/link_path.rb', line 3

def job
  @job
end

#nameObject

Returns the value of attribute name

Returns:

  • (Object)

    the current value of name



3
4
5
# File 'lib/bosh/director/deployment_plan/links/link_path.rb', line 3

def name
  @name
end

#pathObject

Returns the value of attribute path

Returns:

  • (Object)

    the current value of path



3
4
5
# File 'lib/bosh/director/deployment_plan/links/link_path.rb', line 3

def path
  @path
end

#templateObject

Returns the value of attribute template

Returns:

  • (Object)

    the current value of template



3
4
5
# File 'lib/bosh/director/deployment_plan/links/link_path.rb', line 3

def template
  @template
end

Class Method Details

.parse(current_deployment_name, path, logger) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/bosh/director/deployment_plan/links/link_path.rb', line 4

def self.parse(current_deployment_name, path, logger)
  parts = path.split('.')

  if parts.size == 3
    logger.debug("Link '#{path}' does not specify deployment, using current deployment")
    parts.unshift(current_deployment_name)
  end

  if parts.size != 4
    logger.error("Invalid link format: #{path}")
    raise DeploymentInvalidLink,
      "Link '#{path}' is invalid. A link must have either 3 or 4 parts: " +
        "[deployment_name.]job_name.template_name.link_name"
  end

  new(*parts, path)
end

Instance Method Details

#to_sObject



22
23
24
# File 'lib/bosh/director/deployment_plan/links/link_path.rb', line 22

def to_s
  path
end