Class: Bosh::Director::DeploymentPlan::InstanceGroupSpecParser

Inherits:
Object
  • Object
show all
Includes:
IpUtil, ValidationHelper, Template::PropertyHelper
Defined in:
lib/bosh/director/deployment_plan/instance_group_spec_parser.rb

Instance Method Summary collapse

Methods included from IpUtil

#each_ip, #format_ip, #ip_to_i, #ip_to_netaddr

Methods included from ValidationHelper

#safe_property

Constructor Details

#initialize(deployment, event_log, logger) ⇒ InstanceGroupSpecParser

Returns a new instance of InstanceGroupSpecParser.

Parameters:



11
12
13
14
15
# File 'lib/bosh/director/deployment_plan/instance_group_spec_parser.rb', line 11

def initialize(deployment, event_log, logger)
  @deployment = deployment
  @event_log = event_log
  @logger = logger
end

Instance Method Details

#parse(job_spec, options = {}) ⇒ DeploymentPlan::Job

Returns Job as build from job_spec.

Parameters:

  • job_spec (Hash)

    Raw job spec from the deployment manifest

Returns:

  • (DeploymentPlan::Job)

    Job as build from job_spec



19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# File 'lib/bosh/director/deployment_plan/instance_group_spec_parser.rb', line 19

def parse(job_spec, options = {})
  @job_spec = job_spec
  @job = InstanceGroup.new(@logger)

  parse_name
  parse_lifecycle

  parse_release
  validate_templates

  parse_template
  parse_templates

  check_template_uniqueness
  parse_disk
  parse_properties
  parse_resource_pool
  check_remove_dev_tools

  parse_options = {}
  parse_options['canaries'] = options['canaries'] if options['canaries']
  parse_options['max_in_flight'] = options['max_in_flight'] if options['max_in_flight']
  parse_update_config(parse_options)

  networks = JobNetworksParser.new(Network::VALID_DEFAULTS).parse(@job_spec, @job.name, @deployment.networks)
  @job.networks = networks
  assign_default_networks(networks)

  availability_zones = JobAvailabilityZoneParser.new.parse(@job_spec, @job, @deployment, networks)
  @job.availability_zones = availability_zones

  parse_migrated_from

  desired_instances = parse_desired_instances(availability_zones, networks)
  @job.desired_instances = desired_instances

  @job
end